# @FileName  : test5.py
# @Time      : 2025/3/22 14:01
# @Author    : LuZhaoHui
# @Software  : PyCharm

import requests

# FastAPI 服务的 URL
API_URL = "http://192.168.1.90:8000/generate-text"
CLEAR_HISTORY_URL = "http://192.168.1.90:8000/clear_history"

# 构造请求数据
head = {"Content-Type": "multipart/form-data"}
files = {"image": "@/home/dashen-llm/data/image/test/1.jpeg"}
data = {"text": "获取图片全部信息"}

# 发送请求到 FastAPI 服务
# response = requests.post(API_URL, headers=head, files=files, data=data)
response = requests.post(CLEAR_HISTORY_URL)

if response.status_code == 200:
    print("对话已经清除")
    # 获取模型生成的文本
    # output_text = response.json()["output_text"]
    # print(output_text)
else:
    print("请求失败，请稍后再试。")
